<?php

class Form_SiteForm extends Form_Custom_General {
 
    public function init() {
        
        $site_id = $this->createElement('hidden', 'site_id')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($site_id);

        $site_name = $this->createElement('text', 'site_name')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_name"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_name")));
        $this->addElement($site_name);

        $site_phone_1 = $this->createElement('text', 'site_phone_1')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_phone_1"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_phone_1")));
        $this->addElement($site_phone_1);
     
        $site_phone_2 = $this->createElement('text', 'site_phone_2')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_phone_1"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_phone_2")));
        $this->addElement($site_phone_2);

        $site_phone_3 = $this->createElement('text', 'site_phone_3')
                #->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_phone_1"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_phone_3")));
        $this->addElement($site_phone_3);


        $site_email = $this->createElement('text', 'site_email')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_email"))))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_email")));
        $site_email->getValidator('emailAddress')->setMessage($this->translateObj->translate("site_required_valid_email"), Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($site_email);


        

        $com_id = $this->createElement('select', 'com_id')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => "select2 select_site"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_company"))));
        $this->addElement($com_id);

        
        $type_id = $this->createElement('select', 'type_id')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => "select2 select_site"));
               # ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_company"))));
        $this->addElement($type_id);
        
        $site_address = $this->createElement('textarea', 'site_address')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_address"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60", "cols" => "50", "rows" => "3", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_address")));
        $this->addElement($site_address);

        $site_city = $this->createElement('text', 'site_city')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_city"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_city")));
        $this->addElement($site_city);


        $site_country = $this->createElement('select', 'site_country')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array( "class" => "select2 select_site"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_country"))));
        $this->addElement($site_country);

        $site_postal_code = $this->createElement('text', 'site_postal_code')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_zipcode")));
        $this->addElement($site_postal_code);

        $site_guard = $this->createElement('select', 'site_guard')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("class" => "select_site"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_guard"))));
        $this->addElement($site_guard);

        $site_digicode = $this->createElement('text', 'site_digicode')
                #->setRequired(TRUE)
                ->addFilters(array(new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_digicode")));

        $this->addElement($site_digicode);

        $site_keysafe = $this->createElement('select', 'site_keysafe')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("class" => "select_site"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_site_keysafe"))));
        $this->addElement($site_keysafe);

        $site_code = $this->createElement('text', 'site_code')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_code")));
        $this->addElement($site_code);

        $site_key_safe_loc = $this->createElement('textarea', 'site_key_safe_loc')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "cols" => "50", "rows" => "3", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_key_safe_loc")));
        $this->addElement($site_key_safe_loc);

        $site_vulnerabilities = $this->createElement('textarea', 'site_vulnerabilities')
                #->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60", "cols" => "50", "rows" => "3", "class" => "span6", "placeholder" => $this->translateObj->translate("site_frm_vulnerabilities")));
        $this->addElement($site_vulnerabilities);

        $site_status = $this->createElement('select', 'site_status')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("class" => "select_site"))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("site_required_status"))));
        $this->addElement($site_status);


        $submit = $this->createElement('submit','Save')
                ->setAttribs(Array('title' => "Save changes", 'class' => "btn-glow primary"))
                ->setLabel($this->translateObj->translate("frm_save"));
        $this->addElement($submit);


        $reset = $this->createElement('reset','Reset')
                ->setAttribs(Array('title' => "Save changes and continue to edit", 'class' => "btn-glow primary"))
                ->setLabel($this->translateObj->translate("frm_reset"));
        $this->addElement($reset);
    }

}